<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      perspective: 500px;
      transform-style: preserve-3d;
    }
    div {
      width: 200px;
      height: 200px;
      background-color: pink;
      transition: all 3s;
    }
    div:hover {
      /* 正顺时针 */
      transform: rotateX(-90deg); 
    }
    p {
      width: 200px;
      height: 200px;
      background-color: pink;
      transition: all 3s;
    }
    p:hover {
      /* 负顺时针 */
      transform: rotateY(-90deg);
    }

    h1 {
      width: 50px;
      height: 50px;
      background-color: red;
    }

  </style>
</head>
<body>
  <div>
    <h1>1</h1>
  </div>
  <p></p>
</html>